/**
 * @param {number} x
 * @return {number}
 */
 var reverse = function(x) {
  let isPlus = x > 0;
  let smallest = -Math.pow(2, 31);
  let biggest = Math.pow(2, 31) - 1;
  console.log(smallest, biggest)
  if(!x) {
    return x;
  }
  x = Math.abs(x);
  x = String(x);
  let arr = x.split('');
  let result = Number(arr.reverse().join(''));
  if(!isPlus) {
    result = 0 - result;
  }
  return result < smallest || result > biggest ? 0 : result;
};

console.log(reverse(1534236469));